home *** CD-ROM | disk | FTP | other *** search
/ Komputer for Alle 1999 #5 / 1999 CD 5 (black).iso / Delphi3 / install / data.z / PG1.PAS < prev    next >
Encoding:
Pascal/Delphi Source File  |  1997-08-05  |  1.1 KB  |  52 lines

  1. unit PG1;
  2.  
  3. interface
  4.  
  5. uses
  6.   Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
  7.   StdCtrls;
  8.  
  9. type
  10.   TForm1 = class(TForm)
  11.     Button1: TButton;
  12.     procedure Button1Click(Sender: TObject);
  13.    end;
  14.  
  15. var
  16.   Form1: TForm1;
  17.  
  18. implementation
  19.  
  20. {$R *.DFM}
  21.  
  22. uses ComCtrls; // Supports the TProgressBar control
  23.  
  24. procedure TestProgress(Form: TForm; Count: SmallInt);
  25. var
  26.   ProgressBar1: TProgressBar;
  27.   i: SmallInt;
  28. begin
  29.   ProgressBar1 := TProgressBar.Create(Form);
  30.   try
  31.     ProgressBar1.Parent := Form;
  32.     ProgressBar1.Align := alBottom;
  33.     ProgressBar1.Min := 0;
  34.     ProgressBar1.Max := Count;
  35.     ProgressBar1.Step := 1; // the amount to move with the StepIt method
  36.     for i := 1 to Count do
  37.       ProgressBar1.Stepit; // Move one Step amount
  38.     // Instead of StepIt, we could also
  39.     // have coded: Position := i;
  40.     ShowMessage('Now the ProgressBar control will be freed');
  41.   finally
  42.     ProgressBar1.Free;
  43.   end;
  44. end;
  45.  
  46. procedure TForm1.Button1Click(Sender: TObject);
  47. begin
  48.   TestProgress(Self, 1000);
  49. end;
  50.  
  51. end.
  52.